package orthoplanner.com.google.code.ui;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

import orthoplanner.com.google.code.eventhandlers.SaveAsImageHandler;
import orthoplanner.com.google.code.eventhandlers.SaveAsWorkspaceHandler;


public class ExportControlPanel extends JPanel {
	private static final long serialVersionUID = -5700618211321555635L;
	private JButton bSaveAsImage, bSaveAsWorkspace;

	public ExportControlPanel(ImageViewer imgViewer) {
		setFont( new Font("SansSerif", Font.BOLD, 12));
		bSaveAsImage = new JButton("Save Image");
		bSaveAsImage.setFont( new Font("SansSerif", Font.BOLD, 12));
		bSaveAsWorkspace = new JButton("Save Workspace");
		bSaveAsImage.setPreferredSize(new Dimension(100, 30));
		//bSaveAsWorkspace.setPreferredSize(new Dimension(100, 40));
		setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.weightx = 1.0;
		gbc.weighty = 1.0;

		gbc.anchor = GridBagConstraints.CENTER;
		add(bSaveAsImage, gbc);
		gbc.gridy = 1;
		// add(bSaveAsWorkspace,gbc);

		gbc.gridy = 2;
		setBorder(new TitledBorder("Export Controls"));
		bSaveAsImage.addMouseListener(new SaveAsImageHandler(imgViewer));
		bSaveAsWorkspace
				.addMouseListener(new SaveAsWorkspaceHandler(imgViewer));
		bSaveAsWorkspace.setEnabled(false);
	}

}
